package com.eaoa.uc.dictionary.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.query.pub.PubDatadictionaryQuery;
import com.eaoa.uc.dictionary.form.DDictionaryCondition;
import com.eaoa.uc.dictionary.form.DDictionarySearchForm;

/**
 * DDictionary ManageSearch
 * @author zhenglun.zhou
 *
 */
public class DDictionaryManageSearchAction extends EABaseAction{


	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
				
		DDictionarySearchForm sform = (DDictionarySearchForm) form;
		sform.initConditionPost();
		DDictionaryCondition condition = (DDictionaryCondition) sform.getCondition();
		PubDatadictionaryQuery query = new PubDatadictionaryQuery();		
		query.setDdcode(condition.getDdcode());
		query.setDdname(condition.getDdname());
		query.setDddesc(condition.getDddesc());
		query.setPageRange(sform.getPageinfo());
		query.execute();
		request.setAttribute("results", query.getResults());
		return mapping.findForward("success");		
	}
}